<?php
/**
 * Part of the Fuel framework.
 *
 * @package    Fuel
 * @version    1.0
 * @author     Fuel Development Team
 * @license    MIT License
 * @copyright  2010 - 2012 Fuel Development Team
 * @link       http://fuelphp.com
 */

/**
 * Template Controller class
 *
 * A base controller for easily creating templated output.
 *
 * @package Fuel
 * @category Core
 * @author tien.tran@sgame.vn
 */

use Fuel\Core\Lang;
use Fuel\Core\Debug;
use Fuel\Core\Config;

abstract class Controller_Template extends Fuel\Core\Controller_Template
{

    /**
     *
     * @var string page template
     */
    public $template = '';

    /**
     * Load the template and create the $this->template object
     */
    public function before ($template = null)
    {
        if (! is_null($template)) {
            
            $this->template = $template;
        }
        
        if (! empty($this->template) and is_string($this->template)) {
            
            // Load the template
            $this->template = View::forge($this->template);
            
            if (! isset($this->template->author)) {
                
                $this->template->author = Lang::get('site.meta.author');
                $this->template->keywords = Lang::get('site.meta.keywords');
                $this->template->description = Lang::get('site.meta.description');
                $this->template->generator = Fuel\Core\Fuel::VERSION;
            }
        }
        
        return parent::before();
    }

}